package com.qf.point.service.impl;

import com.qf.api.point.dto.PointRetryDTO;
import com.qf.common.core.entity.PointRetry;
import com.qf.common.core.entity.PointRule;
import com.qf.point.mapper.PointRetryMapper;
import com.qf.point.service.PointRetryService;
import com.qf.point.service.PointRuleService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author zdl
 * @date 2025/4/7
 */
@Service
public class PointRetryServiceImpl implements PointRetryService {
    @Resource
    private PointRetryMapper pointRetryMapper;
    @Resource
    private PointRuleService pointRuleService;
    @Override
    public void addPoint(PointRetryDTO pointRetryDTO) {
        PointRetry pointRetry = new PointRetry();
        BeanUtils.copyProperties(pointRetryDTO,pointRetry);
        PointRule pointRule = pointRuleService.ruleInfo(pointRetryDTO.getPointType());
        pointRetry.setPoint(pointRule.getPoint());
        pointRetryMapper.insert(pointRetry);
    }
}
